package com.yc.base.config;

import com.yc.base.support.utils.IdWorker;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.ResourceUtils;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class ResourcesConfig extends WebMvcConfigurationSupport {
	/**
	 * 配置静态文件
	 */
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/static/**").addResourceLocations(
				ResourceUtils.CLASSPATH_URL_PREFIX+"/static/","file:static/");
		super.addResourceHandlers(registry);
	}
	/**
	 * 雪花算法
	 */
	@Bean
	public IdWorker idWorker() {
		return new IdWorker(0, 0);
	}
}
